

function showTime(){
    let today = new Date();

    let hours = today.getHours();

    let minutes = today.getMinutes();
    minutes = String(minutes).padStart( 2 , '0' ) ; // String.prototype.padStart

    let seconds = today.getSeconds();
    seconds = String(seconds).padStart( 2 , '0' ) ;

    let ms = today.getMilliseconds();
    ms = String(ms).padStart( 3 , '0' ) ;

    console.log( `${hours}:${minutes}:${seconds}.${ms}` );
}

for( let i = 1 ; i <= 5 ; i++ ){
    setTimeout( showTime , 1000 * i );
    console.log( i );
}